home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 7586 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  3.1 KB

  1. Path: newshost.lanl.gov!tanmoy
  2. From: tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya)
  3. Newsgroups: comp.arch.arithmetic,comp.lang.c,comp.lang.c++
  4. Subject: Re: Access carry flag from C
  5. Date: 23 Feb 1996 17:20:29 GMT
  6. Organization: Los Alamos National Laboratory
  7. Message-ID: <TANMOY.96Feb23102029@qcd.lanl.gov>
  8. References: <Dn1C9z.DGv.0.net@indra.com> <1996Feb1922.17.19.879@koobera.math.uic.edu>
  9.     <31298D20.41C6@bazis.nl> <danpop.824859220@rscernix>
  10.     <312AFACE.41C6@bazis.nl> <824997378snz@genesis.demon.co.uk>
  11.     <312D850C.2781@bazis.nl>
  12. NNTP-Posting-Host: qcd.lanl.gov
  13. Mime-Version: 1.0
  14. Content-Type: text
  15. In-reply-to: Franz Korntner's message of Fri, 23 Feb 1996 09:12:44 GMT
  16.  
  17. In article <312D850C.2781@bazis.nl>
  18. Franz Korntner <fkorntne@bazis.nl> writes:
  19.  
  20.  
  21. FK: > 
  22. FK: > >According to the (X3J11 / ANSI) standard, the constant
  23. FK: > >INT_MAX (and in this case most limits in limits.h) denotes the minimal
  24. FK: > >limit. It is possible that the physical limit is much higher (or lower
  25. FK: > >in the case of negative values).
  26. FK: > 
  27. FK: > No. The value defined for INT_MAX in limits.h is the maximum value an int
  28. FK: > can hold *on that particular implementation*. The standard requires that
  29. FK: > INT_MAX be at least 32767 on all implementations (but it can be and
  30. FK: > often is higher). So on any implementation:
  31. FK: > 
  32. FK: >   int x = INT_MAX+1;
  33. FK: > 
  34. FK: > is a guaranteed overflow.
  35. FK: 
  36. FK: Wrong. The limits are minima. The above operation does not have to
  37. overflow! 
  38.  
  39. Instead of claiming it is wrong, read the standard. (My previous post
  40. quotes the relevant parts). Where do you find that the `limits are
  41. minima'? What are minima? How can a token like `INT_MAX' be a minima:
  42. I know of no comparison function between tokens without values.
  43.  
  44. (The standard only says that INT_MAX >= 32767: I think you misread
  45. this and hallucinated that INT_MAX is useless.)
  46.  
  47. FK: 
  48. FK: > >and what I really miss in the
  49. FK: > >standard and/or implementation is a inline function 'maxlimitof(int)',
  50. FK: > >analogical to 'sizeof(int)'.
  51. FK: > 
  52. FK: > That is precisely what INT_MAX gives you.
  53. FK: 
  54. FK: INT_MAX is a constant. On some platforms you can force GCC to assume int's
  55. FK: to be 16 bit values. What about INT_MAX then?!?
  56.  
  57. There is no standard conforming way of forcing int's to be 16 bit
  58. values. If an implementation wants to allow a compiler flag to allow
  59. such a thing, it is the compiler's responsibility to make sure that
  60. INT_MAX gets defined appropriately.
  61.  
  62. What do you mean by INT_MAX is a constant? INT_MAX is a token: and is
  63. defined in <limits.h> with a constant int value which is
  64. implementation dependent: an implementation is not only a compiler,
  65. but a compiler with a method of invoking it. 
  66.  
  67. Cheers
  68. Tanmoy
  69. --
  70. tanmoy@qcd.lanl.gov(128.165.23.46) DECNET: BETA::"tanmoy@lanl.gov"(1.218=1242)
  71. Tanmoy Bhattacharya O:T-8(MS B285)LANL,NM87545 H:#9,3000,Trinity Drive,NM87544
  72. Others see <gopher://yaleinfo.yale.edu:7700/00/Internet-People/internet-mail>,
  73. <http://alpha.acast.nova.edu/cgi-bin/inmgq.pl>or<ftp://csd4.csd.uwm.edu/pub/
  74. internetwork-mail-guide>. -- <http://nqcd.lanl.gov/people/tanmoy/tanmoy.html>
  75. fax: 1 (505) 665 3003   voice: 1 (505) 665 4733    [ Home: 1 (505) 662 5596 ]
  76.